<%@page import="models.User"%>
<h1>Daftar User</h1>

<% ArrayList<User> users = (ArrayList<User>) request.getAttribute("users");%>

<table>
    <tbody>
        <tr><th>Email</th><th>Nama Lengkap</th><th>Role</th><th>Aksi</th></tr>
        <% for (int i = 0; i < users.size(); i++) {%>
        <tr>
            <td><%=users.get(i).email%></td>
            <td><%=users.get(i).nama_lengkap%></td>
            <td><%=users.get(i).getRole().deskripsi%></td>
            <td>
                <a href="<%=request.getContextPath()%>/user/update?id=<%=users.get(i).id%>">ubah</a>
            </td>
        </tr>
        <% }%>
    </tbody>
</table>

<script type="text/javascript">
    function showConfirmDialog() {
        return confirm("Apakah Anda yakin untuk menghapus?");
    }
</script>